package com.shop.service;

import com.shop.entity.MerchantMerchant;
import com.shop.mapper.ApplyMapper;
import com.shop.mapper.UserCouponMapper;
import com.shop.model.vo.Rsp;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class ApplyService {
    private final ApplyMapper applyMapper;

    public Rsp getApplyInfo(int userId) {
        return Rsp.success(applyMapper.getApplyInfoByUserId(userId));
    }

    public Rsp addMerchant(int userId, MerchantMerchant merchant) {
        applyMapper.addApply(merchant);
        applyMapper.updateUser(userId,merchant.getId());
        return Rsp.success(applyMapper.getApplyInfoByUserId(userId));
    }
}
